<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="__PUBLIC__/X-admin/css/x-admin.css" media="all">
</head>
<body>
        <div class="x-body">
            <form class="layui-form layui-form-pane">
            <input type="hidden" name="id" id="sid" value="{$list['id']}">
                <div class="layui-form-item">
                    <label for="L_title" class="layui-form-label">
                        发送人
                    </label>
                    <div class="layui-input-block">
                        <input type="text" id="L_title" name="sender" required lay-verify="title" autocomplete="off" class="layui-input" value="{$list['sender']}">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    
                    <label for="L_content" class="layui-form-label" style="top: -2px;">
                        详细描述
                    </label>
                    <div style="width:94%;min-height: 200px;border:3px solid #e6e6e6;border-radius: 2px;border-top:0px;padding: 20px;">
                        {$list['contents']}
                    </div>
                </div>
                <div class="layui-form-item">
                  <div class="layui-input-block">
                    <if condition="$list['status'] eq 1">
                        <button class="layui-btn layui-btn-disabled" style="margin: 0px 35%;" lay-filter="close" lay-submit>
                            已查看
                        </button>
                      <else/>
                        <button class="layui-btn" style="margin: 0px 35%;" lay-filter="formDemo" lay-submit>
                            确认查看
                        </button>
                    </if>
                  </div>
                </div>
            </form>
        </div>

  </body>
  </html>
   <script src="__PUBLIC__/X-admin/lib/layui/layui.js" charset="utf-8"></script>
   <script src="__PUBLIC__/X-admin/js/x-layui.js" charset="utf-8"></script>
   <script>
      layui.use(['form','layer'], function(){
                $ = layui.jquery;
              var form = layui.form();
              layer = layui.layer;


      layui.use('layedit', function(){
        var layedit = layui.layedit;
        layedit.build('demo', {
          tool: []
        }); 
      });


          //监听提交
          form.on('submit(formDemo)', function(data){
            id = $("#sid").val();
              $.ajax({
                type: "post",
                url: "__URL__/update",
                data:{id:id},
                dataType: "json",
                success: 
                function (data) {
                  if(data !='1'){
                    layer.alert("查看失败",{icon:2},function(){
                      var index = parent.layer.getFrameIndex(window.name);
                      parent.layer.close(index);
                      parent.reload();
                    });
                  }else{
                      layer.alert("查看成功",{icon:6},function(){
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        parent.reload();
                      })
                  }
                }
              });
              return false;
            });

           form.on('submit(close)', function(data){
              var index = parent.layer.getFrameIndex(window.name);
              parent.layer.close(index);
              parent.reload();
           });

        });
    </script>